<template>
    <div class="body">
        <div class="new_main" v-for="item in AllList" :key="item.key">
            <div class="new_top">
                <div class="top_info">
                    <div class="top_info_left">
                        <img :src="item.img" alt="">
                        <div class="message">
                            <p>{{ item.StoreName }}</p>
                            <span>{{ item.fans }}万粉丝</span>
                        </div>
                    </div>
                    <div class="top_info_right">
                        <div class="shop" @click="InShop(item.uid)">进入店铺&gt;</div>
                    </div>
                </div>
            </div>
            <div class="new_bottom">
                <div class="new_bottom_mess">
                    <div class="new_bottom_img">
                        <img :src="item.posterimg" alt="">
                    </div>
                    <div class="new_list">
                        <ul>
                            <li>{{ item.productName1 }}</li>
                            <li>{{ item.productName2 }}</li>
                            <li>{{ item.productName3 }}</li>
                            <li>{{ item.productName4 }}</li>
                        </ul>
                    </div>
                </div>
                <span>{{ item.read }}万阅读量</span>
            </div>
            <div class="new_bread">
                <h2>————新品甜点————</h2>
                <p>{{ item.wenan }}</p>
                <ul class="bread_mango">
                    <li v-for="mess in item.info">
                        <img :src="mess.dessertimg" alt="">
                        <p>{{ mess.dessertName }}</p>
                        <span>￥{{ mess.price }}</span>
                    </li>
                </ul>
                <p class="bottom_text">查看更多&gt;</p>
            </div>
        </div>
        <van-loading type="spinner" size="14px" text-size="12px" color="#000">加载中...</van-loading>
    </div>
</template>

<script setup>
import router from '@/router'
import { ref, onMounted } from 'vue';
import { getNewGoodsList } from '@/api/api'
import useZBStore from '@/pinia'
const useStore = useZBStore()
const AllList = ref([])
const initGetList = async () => {
    let { data } = await getNewGoodsList()
    console.log(data);
    AllList.value = data
}
const InShop = (uid) => {
    router.push('/restaurantCard')
    useStore.setUid(uid)
}
onMounted(() => {
    initGetList()
})
</script>

<style lang="scss" scoped>
* {
    padding: 0;
    margin: 0;
}

.body {
    background-color: #f6f6f6;
}

a {
    color: black;
}

.new_main {
    width: 100%;
    box-sizing: border-box;
    font-size: 28px;
    background-color: #fff;

    .new_top {
        width: 656px;
        margin: 0 auto;

        .top_info {
            display: flex;
            align-items: center;
            justify-content: space-between;

            .top_info_left {
                display: flex;
                line-height: 150%;

                img {
                    width: 76px;
                    height: 76px;
                }

                span {
                    font-size: 22px;
                    color: rgba(166, 166, 166, 1);
                    line-height: 150%;
                }
            }

            .top_info_right {
                .shop {
                    color: rgba(255, 141, 26, 1);
                }
            }
        }
    }

    .new_bottom {
        width: 100%;

        .new_bottom_mess {
            height: 252px;
            display: flex;
            margin-top: 20px;
            justify-content: space-between;
            box-sizing: border-box;
            padding: 0 50px;

            .new_bottom_img {
                width: 485px;
                height: 252px;
                margin-right: 20px;

                img {
                    width: 485px;
                    height: 252px;
                }
            }

            .new_list {
                width: 153px;

                ul {
                    display: flex;
                    flex-direction: column;
                    justify-content: space-around;
                    align-items: center;
                    height: 100%;

                    li {
                        background-color: #ff8d1a;
                        width: 153px;
                        height: 57px;
                        color: #fff;
                        line-height: 57px;
                        text-align: center;
                        font-size: 26px;
                    }
                }
            }
        }

        span {
            display: block;
            width: 100%;
            height: 60px;
            line-height: 60px;
            text-align: right;
            padding-right: 40px;
            font-size: 22px;
            color: #a6a6a6;
            box-sizing: border-box;
            margin-top: 20px;
        }
    }

    .new_bread {
        width: 100%;
        border-top: 1px solid #f3f3f3;
        text-align: center;
        color: #505050;
        padding: 30px;
        box-sizing: border-box;

        h2 {
            font-size: 40px;
            height: 90px;
            line-height: 90px;
        }

        p {
            font-size: 23px;
            color: #a6a6a6;
        }

        .bread_mango {
            width: 100%;
            display: flex;
            justify-content: space-around;
            align-items: center;
            margin-top: 20px;

            li {
                width: 210px;

                img {
                    width: 210px;
                    height: 140px;
                    object-fit: cover;
                }

                p {
                    font-size: 28px;
                    margin-top: 20px;
                    color: #383838;
                }

                span {
                    font-size: 28px;
                    color: #383838;
                }
            }
        }

        .bottom_text {
            font-size: 23px;
            height: 41px;
            line-height: 41px;
            margin-top: 90px;
        }
    }

}

.van-loading {
    margin-top: 20px;
    text-align: center;

}
</style>